package chai.ning.multition;

public class More {

	private static final More MA = new More("今天", "today");
	private static final More MS = new More("明天", "tomorrow");

	private String name;
	private String feature;

	private More(String name, String feature) {
		this.name = name;
		this.feature = feature;
	}

	public static More getInstance(int index) {
		switch (index) {
		case 1:
			return MA;
		case 2:
			return MS;
		default:
			return null;
		}
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getFeature() {
		return feature;
	}

	public void setFeature(String feature) {
		this.feature = feature;
	}

	@Override
	public String toString() {

		return "[" + name + feature + "]";
	}

	public static void main(String[] args) {

		More f = More.getInstance(1);
		More g = More.getInstance(1);
		More h = More.getInstance(1);

		System.out.println(f == g);
		System.out.println(g == h);
		System.out.println("-------------------");

		System.out.println(f.equals(g));
		System.out.println(g.equals(h));
		System.out.println("-------------------");

		System.out.println(f.toString());
		System.out.println(g.toString());
		System.out.println(h.toString());
		System.out.println("-------------------");

//		More j = More.getInstance(3);
//		System.out.println(j.name + j.feature);
	}
}